﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CS322_V5
{
    public partial class FormFibonaci : Form
    {
        public FormFibonaci()
        {
            InitializeComponent();
        }

        private void btnIzracunaj_Click(object sender, EventArgs e)
        {
            lblRezultat.Text = Convert.ToString(Fibonacci(Convert.ToInt16(tbxUlaz.Text)));

        }

        static int Fibonacci(int x)
        {
           // Console.WriteLine("x = {0}", x);
            if (x <= 1)
            {
                return 1;
            }
            return Fibonacci(x - 1) + Fibonacci(x - 2);
        }

    }
}
